 # # 字符串str
# # # 1.使用引号，包括单引号，双引号，三引号进行创建
# s1 ='hell world'
# print(s1)
# print(type(s1))
#
# s2 = '你好，石家庄'
# print(s2)
# print(type(s2))
# #
# # # 2.使用str()函数进行创建
# num1 = 10
# print(type(num1))
# s3 = str(num1)
# print(s3)
# print(type(s3))
# num2 = 3.141592653
# print(type(num2))
# s4 = str(num2)
# print(s4)
# print(type(s4))
#
# # # 字符串的格式化
# # # 1.使用替代符%
# # # 浮点型转化
# s5 = '浮点数精确为： %f' % 1.2345
# print(s5)
# s6 = '浮点数精确为： %.3f' % 1.2345
# print(s6)
# # # 整型转化
# s7 = '整数精确为： %d' % 1.2345
# print(s7)
# # # 字符串转化
# s8 = '字符串为： %s' % 1.2345
# print(s8)
# # # 2.通过format()函数格式化，格式如下
# # # '{}'.format(str)
# # # {} {}format(str1,str2)
# # print('{}{}'.format('hello','world'))
# # # 字符串的合并
# # # 1.使用“+”对多个字符串进行连接
# s9 = "heiio"
# s10 = "world"
# print(s9+s10)
# ss1 = "111"
# ss2 = '222'
# s = ss1 + ss2
# print(s)
# # # 使用星号(*)表示重复
# print(s9*10)
# #
# # # 2.使用join函数配合列表实现对多个字符串的链接，join()
# s11 = ['hello', 'python', 'hello', 'world']
# s12 = '123'
# print(''.join(s11))
# print(s12.join(s11))
# # 字符串的截取
# # 1.使用索引截取单个字符
# s13 = 'python'
# print(s13[3])
# print(s13[-3])
# #
# # 2.使用切片截取字符串，字符串名[start:end:step]前闭后开
# s14 = 'python'
# print(s14[0:5])
# print(s14[2:5])
# print(s14[3:1])
# # 3.
# s15 = '我们999  很好'
# print(s15.split())
# print(s15.split('999'))
#
#
# #字符串的比较
# # 1.字符串
# s1 = 234
# s2 = '234'
# if s1 == s2:
#     print('相同')
# else:
#     print('不同')
#
#  # 转化数据类型
# if str(s1) == s2:
#      print('相同')
# else:
#     print('不相同')
#
# # 字符串的长度
# # 1.字符串
# s3 = 'hello,world'
# print(len(s3))
# # # 2.列表
# l1 = [1, 2, 3, 4, 'hello', 'world', '!']
# print(len(l1))
#
# # 字符串的查找find()
# s4 = '1234563333'
# print(s4.find('3'))
# print(s4.find('123'))
# # 如果没有，返回-1
# print(s4.find('d'))
#
# # 替换:replace(old,new)
# s5 = "hello world! hello python! hello shijiazhuang!"
# s6 = s5.replace('hello', 'hi')
# print(s6)
# s7 = s6 = s5.replace('hello', 'hi', 2)
# print(s7)
# s8 = s5.replace(' ', '')
# print(s8)
#
# # 字符串的遍历for循环
# # 使用for循环遍历字符串
# s9 = "hello,world!"
# for i in s9:
#     print(i, end='   ')
# # 使用索引遍历字符串打印每个字符。range()函数：生成序列，从0开始
# s10 = "hello, world!"
# print(len(s10))
# for i in range(len(s10)):
#     print(s10[i], end='         ')
#     print()
#     # 遍历字符串的部分字符打印
# s11 = "hello，world！"
# for i in s11[7:12]:
#     print(i, end='  ')

